home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 49 / Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso / -serious- / comms / other / novia / bin / who.c < prev   
C/C++ Source or Header  |  1999-12-06  |  2KB  |  65 lines

  1. #include <pragma/noviasys_lib.h>
  2. #include <pragma/exec_lib.h>
  3. #include <pragma/dos_lib.h>
  4. #include <stdio.h>
  5. #include <novia/novia_portdata.h>
  6.  
  7. struct Library *NoviaSysBase;
  8.  
  9. void ioprintf(const char *string, ...)
  10. {
  11.     char *buffer=AllocVec(10000,MEMF_ANY|MEMF_CLEAR);
  12.     if (buffer)
  13.     {
  14.         vsprintf(buffer, string, unsigned int(&string + 1));
  15.         Writeio(buffer,-1);
  16.         FreeVec(buffer);
  17.     }
  18. }
  19.  
  20. void main()
  21. {
  22.     if ((NoviaSysBase = OpenLibrary("noviasys.library", 0)))
  23.     {
  24.         struct PortData *cport = (struct PortData *)FindTask(NULL)->tc_UserData;
  25.             if (cport==mport)
  26.             {
  27. /*                struct PortData2 *clientport;
  28.                 struct PortData *cport2;
  29.                 char *txtptr=AllocVec(1000,MEMF_ANY|MEMF_CLEAR);
  30.                 if (txtptr=AllocVec(1000,MEMF_ANY|MEMF_CLEAR))
  31.                 {
  32.                     sprintf(txtptr,"Port Username            Logon  Spd From                Where        \n");
  33.                     txtptr=txtptr+strlen(txtptr);
  34.                     sprintf(txtptr,"==== =================== ====== === =================== =============\n");
  35.                     txtptr=txtptr+strlen(txtptr);
  36.                     clientport=(PortData2 *)client_list->lh_Head;
  37.                     while (clientport->port_node.ln_Succ)
  38.                     {
  39.                         cport2=clientport->port_address;
  40.                         sprintf(buffer,"%4d %-19s %2d:%02d  %3d %-19s %s\n",
  41.                             cport2->clientconfig.IDNumber,
  42.                             cport2->LocalUser.Handle,
  43.                             cport2->LastLogin.hours,
  44.                             cport2->LastLogin.mins,
  45.                             cport2->CurrentCPS,
  46.                             cport2->LocalUser.City,
  47.                             cport2->Where);
  48.                         strcpy(txtptr,buffer);
  49.                         txtptr=txtptr+strlen(buffer);
  50.                         clientport=(PortData2 *)clientport->port_node.ln_Succ;
  51.                     }
  52.                     ioprintf(txtptr,-1);
  53.                     FreeVec(txtptr);
  54.                 }*/
  55.                 startrexxprg("rexxc:noviatest.rexx");
  56.             }
  57.             else
  58.             {
  59.                 ioprintf("Your User: %d from %s\n",cport->clientconfig.IDNumber,cport->whostring);
  60.                 SendMsg(cport->MainPort,0,0,MSG_COMMAND,CMD_WHO);
  61.             }
  62.             return TRUE;
  63.         CloseLibrary(NoviaSysBase);
  64.     }
  65. }